﻿#pragma once
#include "afxdialogex.h"
#include <vector>
// CCustomFolderPickerDialog 对话框

class CCustomFolderPickerDialog : public CDialogEx
{
	DECLARE_DYNAMIC(CCustomFolderPickerDialog)

public:
	CCustomFolderPickerDialog(CWnd* pParent = nullptr);   // 标准构造函数
	virtual ~CCustomFolderPickerDialog();

// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_CUSTOMFOLDERPICKER };
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
	HICON m_hIcon;
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedCancel();
	/*afx_msg void OnNMDblclkFolderTree(NMHDR* pNMHDR, LRESULT* pResult);*/
	afx_msg void OnTvnItemExpandingFolderTree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnPaint();
	afx_msg void OnTvnItemChangedFolderTree(NMHDR* pNMHDR, LRESULT* pResult);
	CTreeCtrl m_FolderTree;
	virtual BOOL OnInitDialog();
	std::vector<CString> GetSelectedPaths() const;
	std::vector<CString> m_selectedPaths;
private:
	void AddDrivesToTree();
	void AddSubFoldersToTree(HTREEITEM hParent, const CString& currentPath);
	void AddSelectedPaths(HTREEITEM hItem, CString currentPath, std::vector<CString>& selectedPaths) const;
};
